package com.taobao.api.request;

import java.util.Map;

import com.taobao.api.ApiRuleException;
import com.taobao.api.TaobaoRequest;
import com.taobao.api.internal.util.RequestCheckUtils;
import com.taobao.api.internal.util.TaobaoHashMap;
import com.taobao.api.response.TaobaokeShopsRelateGetResponse;

/**
 * TOP API: taobao.taobaoke.shops.relate.get request
 * 
 * @author auto create
 * @since 1.0, 2013-08-03 16:51:00
 */
public class TaobaokeShopsRelateGetRequest implements TaobaoRequest<TaobaokeShopsRelateGetResponse> {

  private Map<String, String> headerMap = new TaobaoHashMap();
  private TaobaoHashMap       udfParams;                      // add
                                                              // user-defined
                                                              // text parameters
  private Long                timestamp;

  /**
   * 需返回的字段列表.可选值:TaobaokeShop淘宝客商品结构体中的user_id,seller_nick,shop_id,shop_title
   * ,seller_credit,shop_type,commission_rate,click_url,total_auction,
   * auction_count,字段之间用","分隔
   */
  private String              fields;

  /**
   * 标识一个应用是否来在无线或者手机应用,如果是true则会使用其他规则加密点击串,如果不传值,则默认是false
   */
  private Boolean             isMobile;

  /**
   * 指定返回结果的最大条数,实际返回结果个数根据算法来确定
   */
  private Long                maxCount;

  /**
   * 淘宝用户昵称.注:指的是淘宝的会员登录名.如果昵称错误,那么客户就收不到佣金.每个淘宝昵称都对应于一个pid,在这里输入要结算佣金的淘宝昵称,
   * 当推广的商品成功后,佣金会打入此输入的淘宝昵称的账户.具体的信息可以登入阿里妈妈的网站查看
   */
  private String              nick;

  /**
   * 自定义输入串.格式:英文和数字组成;长度不能大于12个字符,区分不同的推广渠道,如:bbs,表示bbs为推广渠道;blog,表示blog为推广渠道
   */
  private String              outerCode;

  /**
   * 用户的pid,必须是mm_xxxx_0_0这种格式中间的"xxxx".
   * 注意nick和pid至少需要传递一个,如果2个都传了,将以pid为准,且pid的最大长度是20。第一次调用接口的用户，推荐该入参不要填写，
   * 使用nick=（淘宝账号）的方式去获取，以免出错。
   */
  private Long                pid;

  /**
   * 卖家id.seller_id和seller_nick不能同时为空,如果都有值,则以seller_id为主
   */
  private Long                sellerId;

  /**
   * 卖家昵称
   */
  private String              sellerNick;

  /**
   * 店铺类型.所有:all,商城:b,集市:c
   */
  private String              shopType;

  /**
   * default(默认排序,关联推荐相关度),commissionRate_desc(佣金比率从高到低),
   * commissionRate_asc(佣金比率从低到高),credit_desc(信用等级从高到低), credit_asc(信用等级从低到高)
   */
  private String              sort;

  public void setFields(String fields) {
    this.fields = fields;
  }

  public String getFields() {
    return this.fields;
  }

  public void setIsMobile(Boolean isMobile) {
    this.isMobile = isMobile;
  }

  public Boolean getIsMobile() {
    return this.isMobile;
  }

  public void setMaxCount(Long maxCount) {
    this.maxCount = maxCount;
  }

  public Long getMaxCount() {
    return this.maxCount;
  }

  public void setNick(String nick) {
    this.nick = nick;
  }

  public String getNick() {
    return this.nick;
  }

  public void setOuterCode(String outerCode) {
    this.outerCode = outerCode;
  }

  public String getOuterCode() {
    return this.outerCode;
  }

  public void setPid(Long pid) {
    this.pid = pid;
  }

  public Long getPid() {
    return this.pid;
  }

  public void setSellerId(Long sellerId) {
    this.sellerId = sellerId;
  }

  public Long getSellerId() {
    return this.sellerId;
  }

  public void setSellerNick(String sellerNick) {
    this.sellerNick = sellerNick;
  }

  public String getSellerNick() {
    return this.sellerNick;
  }

  public void setShopType(String shopType) {
    this.shopType = shopType;
  }

  public String getShopType() {
    return this.shopType;
  }

  public void setSort(String sort) {
    this.sort = sort;
  }

  public String getSort() {
    return this.sort;
  }

  public Long getTimestamp() {
    return this.timestamp;
  }

  public void setTimestamp(Long timestamp) {
    this.timestamp = timestamp;
  }

  public String getApiMethodName() {
    return "taobao.taobaoke.shops.relate.get";
  }

  public Map<String, String> getTextParams() {
    TaobaoHashMap txtParams = new TaobaoHashMap();
    txtParams.put("fields", this.fields);
    txtParams.put("is_mobile", this.isMobile);
    txtParams.put("max_count", this.maxCount);
    txtParams.put("nick", this.nick);
    txtParams.put("outer_code", this.outerCode);
    txtParams.put("pid", this.pid);
    txtParams.put("seller_id", this.sellerId);
    txtParams.put("seller_nick", this.sellerNick);
    txtParams.put("shop_type", this.shopType);
    txtParams.put("sort", this.sort);
    if (this.udfParams != null) {
      txtParams.putAll(this.udfParams);
    }
    return txtParams;
  }

  public void putOtherTextParam(String key, String value) {
    if (this.udfParams == null) {
      this.udfParams = new TaobaoHashMap();
    }
    this.udfParams.put(key, value);
  }

  public Class<TaobaokeShopsRelateGetResponse> getResponseClass() {
    return TaobaokeShopsRelateGetResponse.class;
  }

  public void check() throws ApiRuleException {
    RequestCheckUtils.checkNotEmpty(fields, "fields");
  }

  public Map<String, String> getHeaderMap() {
    return headerMap;
  }
}
